﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Test
{
    public partial class FrmMain : Form
    {
        public FrmMain()
        {
            InitializeComponent();
            this.Load += frmMain_Load;
            this.btnTest.Click += btnTest_Click;
            this.btnRemove.Click += btnRemove_Click;
        }

        private void btnRemove_Click(object sender, EventArgs e)
        {
            Client.ClientCalculatorService.Instance.UnRegist();
        }

        private void btnTest_Click(object sender, EventArgs e)
        {
            try
            {
                Domain.Entities.OperModel operModel = new Domain.Entities.OperModel { x = 1, y = 2 };
                string json = Client.ClientCalculatorService.Instance.Add(Newtonsoft.Json.JsonConvert.SerializeObject(operModel));

                var item = Newtonsoft.Json.JsonConvert.DeserializeObject<Domain.Entities.OperModel>(json);
                this.lbxCommand.Items.Add(json);

                LogManagement.Log4netHelper.LogInfo(LogManagement.Log4netType.Info, "客户端日志记录", "");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
        }
    }
}